package com.csc.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.csc.dao.CustomerDao;
import com.csc.domain.Customer;

@Service
public class CustomerServiceImpl implements CustomerService {

	@Autowired
	private CustomerDao customerDao;

	static final Logger logger = Logger.getLogger(CustomerServiceImpl.class);
	
	/*
	 * @author:  Hoang Hung*/
	public Customer searchCustomerByIDCard(String IDcard) {
		logger.info("searchCustomerByIDCard is called...");
		List<Customer> customers = customerDao.getAllCustomer();
		Customer cust = null;
		for (Customer customer : customers) {
			if (customer.getIdCardNumber().equals(IDcard)) {
				cust = customer;
				break;
			}
		}
		return cust;
	}
}
